package com.zyj.jetpackdemo.moudle

import android.content.Context
import android.os.Bundle
import android.util.Log
import androidx.activity.compose.setContent
import androidx.appcompat.app.AppCompatActivity
import androidx.compose.runtime.Composable
import com.zyj.jetpackdemo.*
import com.zyj.jetpackdemo.composes.*

class ComposeDetailActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val type = intent.getIntExtra(INTENT_DETAIL_TYPE, 0)
            val clickIndex = intent.getIntExtra(INTENT_DATA, 0)
            when (type) {
                0 -> ShowColumnCompose(clickIndex, this)
                1 -> ShowGraphicCompose(clickIndex, this)
            }
        }
    }
}


@Composable
fun ShowColumnCompose(index: Int, context: Context) {
    when (index) {
        0 -> BasicListCompose()
        1 -> LazyListCompose()
        2 -> ContentPadding()
        3 -> ContentSpacing()
        4 -> StickyHeader()
        5 -> StickyGroupHeader()
        6 -> GridCompose(content = gridData)
        7 -> ReactingScroll(context)
        8 -> ControllingScroll()
        9 -> LargeDataOfPaging()
    }
}

@Composable
fun ShowGraphicCompose(index:Int, context:Context) {
    when(index){
        0 -> DrawLine()
        1 -> DrawCircle()
        2 -> DrawRect()
        3 -> DrawInset()
        4 -> TransformationOfRotate()
        5 -> DrawWithTransformFunction()
    }
}